#设置cmake最低版本
cmake_minimum_required(VERSION 3.4.1)

#设置项目名称
project(tst_qtbase_auto_widgets)

#引入add_module模板文件
include(${ISSQTTESTROOTDIR}/cmake/add_module.cmake)

#设置测试类型，auto为自动测试，manual为手动测试,即test目录下的文件夹名
set(TEST_TYPE auto)
#设置模块名
set(MODULE qtbase)
#设置需要链接的模块
set(LinkQt Core Gui Widgets Network Concurrent OpenGL Sql Svg Quick Xml PrintSupport)
#设置需要链接的模块的私有模块
set(LinkQtPrivate Core Test Gui Widgets Sql Network OpenGL Concurrent PrintSupport)

add_definitions("-DQT_DISABLE_DEPRECATED_BEFORE=0" "-DSRCDIR=\"/data/storage/el2/base/temp/\"")
get_filename_component(CMAKE_NATIVE_MAKE_PROGRAM ${CMAKE_MAKE_PROGRAM} NAME)
add_definitions(-DDEFAULT_MAKESPEC="${CMAKE_NATIVE_MAKE_PROGRAM}")


set(CodeRootPath ${ISSQTTESTROOTDIR}/qtbase)
include_directories(${CodeRootPath}/3rdparty/tinycbor/src
                    ${CodeRootPath}/3rdparty/tinycbor/tests
                    ${CodeRootPath}/3rdparty/tinycbor/tests/encoder
                    ${CodeRootPath}/3rdparty/tinycbor/tests/parser
                    ${CodeRootPath}/tests/auto/other/qvariant_common
                    ${CodeRootPath}/tests/auto/corelib/kernel/qcoreapplication
                    ${CodeRootPath}/tests/baselineserver/shared
                    ${CodeRootPath}/tests/
                    ${CodeRootPath}/tests/auto/other/qabstractitemmodelutils
                    ${CodeRootPath}/tests/shared
                    ${CodeRootPath}/tests/auto/corelib/kernel/qmetatype)


#多级目录
set(TEST_ITEMS ${TEST_ITEMS}
     #其他测试项需要
     other/qabstractitemmodelutils
     widgets/dialogs
     widgets/effects
     widgets/graphicsview
     widgets/itemviews
     widgets/styles
     widgets/util
#     widgets/widgets           #appfreeze(QWindowPrivate::setVisible(bool))
)

#排出不需要的.cpp
set(EXCLUDE_SRC ${EXCLUDE_SRC}
    #private test
    widgets/dialogs/qsidebar/tst_qsidebar.cpp 
    widgets/graphicsview/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp 
    widgets/graphicsview/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp 
    widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp 
    widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp 
    widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp 
    widgets/graphicsview/qgraphicssceneindex/tst_qgraphicssceneindex.cpp 
    widgets/itemviews/qcolumnview/tst_qcolumnview.cpp 
    widgets/itemviews/qitemview/tst_qitemview.cpp 
    widgets/itemviews/qlistwidget/tst_qlistwidget.cpp 
    widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp 
    widgets/widgets/qabstractspinbox/tst_qabstractspinbox.cpp 
    widgets/widgets/qcombobox/tst_qcombobox.cpp 
    widgets/widgets/qmainwindow/tst_qmainwindow.cpp 
    widgets/widgets/qtoolbar/tst_qtoolbar.cpp
    #Mac系统
    widgets/styles/qmacstyle/tst_qmacstyle.cpp


    widgets/dialogs/qfiledialog/tst_qfiledialog.cpp                             #timeout
    widgets/graphicsview/qgraphicseffectsource/tst_qgraphicseffectsource.cpp    #SIGSEGV(SEGV_MAPERR)(QPlatformPixmap::isNull())
    widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp      #appfreeze
    widgets/util/qcompleter/tst_qcompleter.cpp                                  #probably caused by NULL pointer dereference
)

add_sources(
    /widgets/dialogs/qdialog/tst_qdialog.cpp
    /widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp
    /corelib/kernel/qpointer/tst_qpointer.cpp
#    opengl/qgl/tst_qgl.cpp                                                      #probably caused by NULL pointer dereference(OH_NativeXComponent::DetachNativeRootNode)
)

#0为使用widget_main，1为使用gui_main,2使用core_main,3使用appless_main，4或其他使用none_main
set(MANUAL_ADD_MAIN 0)

set(PLUGINS QOpenHarmonyPlatformIntegrationPlugin)

#再把TEST_ITEMS传给create_library整合测试项，生成测试库
#整合测试项，生成测试库，名字当前工程名，即project(tst_qtcharts_auto)中定义的tst_qtcharts_auto
create_library(${TEST_ITEMS})

